package com.nari.ncps.screen.dto.excelbase;

import com.nari.ncps.screen.dto.excelimport.coal.*;

import java.util.HashMap;
import java.util.Map;

public class ExcelEntityRegistry {


    private static final Map<String, Class<?>> TABLE_TO_ENTITY_MAP = new HashMap<>();

    static {
        // 手动注册表名与实体类的映射
        TABLE_TO_ENTITY_MAP.put("coal_prodoper_output", CoalProdoperOutputDto.class);
        TABLE_TO_ENTITY_MAP.put("coal_inventory", CoalSafetyenvAlarmDto.class);
        // ... 其他16张表

        // 煤炭模块 - 15张表的映射关系
        // 安全环保相关
        TABLE_TO_ENTITY_MAP.put("coal_safetyenv_alarm", CoalSafetyenvAlarmDto.class);
        TABLE_TO_ENTITY_MAP.put("coal_safetyenv_risk_deal", CoalSafetyenvRiskDeal.class);
        TABLE_TO_ENTITY_MAP.put("coal_safetyenv_restoration", CoalSafetyenvRestoration.class);

        // 运行监测相关
        TABLE_TO_ENTITY_MAP.put("coal_opermon_rt_slope_alarm", CoalOpermonRtSlopeAlarm.class);
        TABLE_TO_ENTITY_MAP.put("coal_opermon_rt_effect", CoalOpermonRtEffect.class);
        TABLE_TO_ENTITY_MAP.put("coal_opermon_rt_output", CoalOpermonRtOutput.class);
        TABLE_TO_ENTITY_MAP.put("coal_opermon_equip_fault", CoalOpermonEquipFaultDto.class);
        TABLE_TO_ENTITY_MAP.put("coal_opermon_equip_use", CoalOpermonEquipUse.class);

        // 概览相关
        TABLE_TO_ENTITY_MAP.put("coal_overview_item", CoalOverviewItem.class);

        // 生产经营相关
        TABLE_TO_ENTITY_MAP.put("coal_prodoper_sales_structure", CoalProdoperSalesStructure.class);
        TABLE_TO_ENTITY_MAP.put("coal_prodoper_transport", CoalProdoperTransport.class);
        TABLE_TO_ENTITY_MAP.put("coal_prodoper_sales", CoalProdoperSales.class);
        TABLE_TO_ENTITY_MAP.put("coal_prodoper_stock", CoalProdoperStock.class);
        TABLE_TO_ENTITY_MAP.put("coal_prodoper_osv", CoalProdoperOsv.class);
        TABLE_TO_ENTITY_MAP.put("coal_prodoper_output", CoalProdoperOutputDto.class);

    }

    public static Class<?> getEntityClassByTableName(String tableName) {
        Class<?> clazz = TABLE_TO_ENTITY_MAP.get(tableName);
        if (clazz == null) {
            throw new IllegalArgumentException("未找到表名 [" + tableName + "] 对应的导入实体类");
        }
        return clazz;
    }
}
